﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <div>
    <el-form ref="formRefPassStationRecord" :model="statePassStationRecord.vmModel" label-width="100px">
      <el-row>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LineCode_FormItem" prop="Entity.LineCode" :label="$t('message.autotrans._Model_PassStationRecord_lineCode')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_PassStationRecord_lineCode')}), trigger: 'blur' }]" >
            <el-input v-model="statePassStationRecord.vmModel.Entity.LineCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MaterialCode_FormItem" prop="Entity.MaterialCode" :label="$t('message.autotrans._Model_PassStationRecord_materialCode')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.MaterialCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MaterialName_FormItem" prop="Entity.MaterialName" :label="$t('message.autotrans._Model_PassStationRecord_materialName')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.MaterialName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MaterialVersion_FormItem" prop="Entity.MaterialVersion" :label="$t('message.autotrans._Model_PassStationRecord_materialVersion')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.MaterialVersion" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationCode_FormItem" prop="Entity.OperationCode" :label="$t('message.autotrans._Model_PassStationRecord_operationCode')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.OperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OrderCode_FormItem" prop="Entity.OrderCode" :label="$t('message.autotrans._Model_PassStationRecord_orderCode')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.OrderCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_PassBeginTime_FormItem" prop="Entity.PassBeginTime" :label="$t('message.autotrans._Model_PassStationRecord_passBeginTime')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.PassBeginTime" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_PassEndTime_FormItem" prop="Entity.PassEndTime" :label="$t('message.autotrans._Model_PassStationRecord_passEndTime')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.PassEndTime" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_PassStatus_FormItem" prop="Entity.PassStatus" :label="$t('message.autotrans._Model_PassStationRecord_passStatus')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.PassStatus" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ScheduleCode_FormItem" prop="Entity.ScheduleCode" :label="$t('message.autotrans._Model_PassStationRecord_scheduleCode')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.ScheduleCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_SnNumber_FormItem" prop="Entity.SnNumber" :label="$t('message.autotrans._Model_PassStationRecord_snNumber')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_PassStationRecord_snNumber')}), trigger: 'blur' }]" >
            <el-input v-model="statePassStationRecord.vmModel.Entity.SnNumber" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_StationCode_FormItem" prop="Entity.StationCode" :label="$t('message.autotrans._Model_PassStationRecord_stationCode')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.StationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ShipCode_FormItem" prop="Entity.ShipCode" :label="$t('message.autotrans._Model_PassStationRecord_shipCode')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.ShipCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_MachineCode_FormItem" prop="Entity.MachineCode" :label="$t('message.autotrans._Model_PassStationRecord_machineCode')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.MachineCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Uploadflag_FormItem" prop="Entity.Uploadflag" :label="$t('message.autotrans._Model_PassStationRecord_uploadflag')">
            <el-select v-model="statePassStationRecord.vmModel.Entity.Uploadflag" clearable>
               <el-option :key="1" :value=true :label="$t('message._system.common.vm.tips_bool_true')"></el-option>
               <el-option :key="0" :value=false :label="$t('message._system.common.vm.tips_bool_false')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_UserId_FormItem" prop="Entity.UserId" :label="$t('message.autotrans._Model_PassStationRecord_userId')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.UserId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_UserName_FormItem" prop="Entity.UserName" :label="$t('message.autotrans._Model_PassStationRecord_userName')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.UserName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_IsProduct_FormItem" prop="Entity.IsProduct" :label="$t('message.autotrans._Model_PassStationRecord_isProduct')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.IsProduct" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ReqType_FormItem" prop="Entity.ReqType" :label="$t('message.autotrans._Model_PassStationRecord_reqType')">
            <el-input v-model="statePassStationRecord.vmModel.Entity.ReqType" clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

      <div style="text-align:right;">
        <WtmButton @click="onSubmitPassStationRecord"  type="primary" :button-text="$t('message.autotrans.SysSubmit')" style="margin-top:15px;"/>

        <WtmButton @click="onClosePassStationRecord"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

      </div>

    </el-form>

  </div>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageRecordPassStationRecordCreate;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { passstationrecordApi } from '/@/api/record/passstationrecord';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefPassStationRecord = ref();
const statePassStationRecord = reactive({
    vmModel: {
	  Entity:{
        LineCode: '',
        MaterialCode: '',
        MaterialName: '',
        MaterialVersion: '',
        OperationCode: '',
        OrderCode: '',
        PassBeginTime: '',
        PassEndTime: '',
        PassStatus: '',
        ScheduleCode: '',
        SnNumber: '',
        StationCode: '',
        ShipCode: '',
        MachineCode: '',
        Uploadflag: undefined,
        UserId: '',
        UserName: '',
        IsProduct: '',
        ReqType: '',
      },

	},
    
});

// 取消
const onClosePassStationRecord = () => {
    closeDialog();
};

// 提交
const onSubmitPassStationRecord = () => {
 	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});
   formRefPassStationRecord.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            passstationrecordApi().add(statePassStationRecord.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
	})
};

// 页面加载时
onMounted(() => {
    
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

